package org.test;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class QueryServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		Map<String, Map> users = new HashMap<String, Map>();
		Map<String, String> user1 = new HashMap<String, String>();
		user1.put("name", "user1");
		users.put("user1", user1);
		
		Map<String, String> user2 = new HashMap<String, String>();
		user2.put("name", "user2");
		users.put("user2", user2);
		
		Map<String, String> user3 = new HashMap<String, String>();
		user3.put("name", "user3");
		users.put("user3", user3);
		
		req.setAttribute("users", users);
		System.out.println("Enter doGet, " + req.getContextPath() + "/index.jsp");
		req.getRequestDispatcher("/testIndex.jsp").forward(req, resp);
	}
}
